package com.a9_lin.www.testormlite.bean;

import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

import java.io.Serializable;

/**
 * 每个设备的具体信息
 * Created by macmini on 16/8/30.
 */
@DatabaseTable(tableName = "tb_userinfo")
public class Userinfo implements Serializable{

    private static final long serialVersionUID = 1L;

    @DatabaseField(generatedId = true)
    private int id;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    /**
     * 最大的不同在这里 我们需要将其所属于的集合所在的对象的引用放在这里 这样 ormlite才能正确存储并恢复这些数据
     * 其中列名是随便取的
     */
    @DatabaseField(foreign = true,foreignAutoRefresh = true,columnName = "userinfolist_id")
    private UserInfoListBean userInfoListBean;

    public UserInfoListBean getUserInfoListBean() {
        return userInfoListBean;
    }

    public void setUserInfoListBean(UserInfoListBean userInfoListBean) {
        this.userInfoListBean = userInfoListBean;
    }

    @DatabaseField(canBeNull = true,foreign = true,columnName = "watch")
    private Watch watch;

    @DatabaseField(canBeNull = true,foreign = true,foreignAutoRefresh = true,columnName = "wearer")
    private Wearer Wearer;

    public void setWatch(Watch watch){
        this.watch = watch;
    }
    public Watch getWatch(){
        return this.watch;
    }
    public void setWearer(Wearer Wearer){
        this.Wearer = Wearer;
    }
    public Wearer getWearer(){
        return this.Wearer;
    }

    @Override
    public String toString() {
        return "Userinfo{" +
                "watch=" + watch +
                ", Wearer=" + Wearer +
                '}';
    }
}
